package call

import (
	"dmsv/agent"
	"dmsv/ivr"
	"time"
)

const (
	C_EVENT_FAIL     = "fail"
	C_EVENT_KEY      = "key"
	C_EVENT_PLAYOVER = "playover"
	C_EVENT_LEAVEMSG = "leavemsg"
	C_EVENT_CREATE   = "create"
	C_EVENT_ANSWER   = "answer"
	C_EVENT_RING     = "ring"
	C_EVENT_TIME_OUT = "timeout"
	C_EVENT_DESTROY  = "destroy"
	C_EVENT_TRANSFER = "transfer"
	C_EVENT_CALL_OUT = "callout"
	C_EVENT_TO_QUEUE = "enque"
)

type CallEvent struct {
	Name   string
	EvTime time.Time
	Call   *CallInfo
	Data   interface{}
}

type DTMF_ARGS struct {
	KeyStop    bool   //按键停止播放音乐
	EndKey     string //按键停止收集
	MaxKey     int    //最多收取按键个数,0为一直接收
	TimeOut    int    //超时时间
	KeyTimeOut int    //按键间隔时间
	MediaFile  string //放音文件
	PlayTimes  int
}

type CallInfo struct {
	fCallId           string
	sessionId         string
	BgJobId           string
	Caller            string
	Callee            string
	ServiceId         string
	callDir           string //呼入、呼出
	legDir            string //坐席、用户
	agent             *agent.AgentInfo
	ispstn            bool
	ringCheck         bool
	callAgent         bool
	CreateTime        time.Time
	StartTime         time.Time
	RingTime          time.Time
	EarlyMediaTime    time.Time
	AnswerTime        time.Time
	EnqueTime         time.Time
	EndTime           time.Time
	DtmfTime          time.Time
	LeaveMsgTime      time.Time
	lastPlay          string
	QueId             int
	queueName         string
	Dtmf              string
	currentNodeType   string
	timerChan         chan bool
	dtmfChan          chan string
	transfer          string //转接类型
	waitRunOver       bool   //转接前的基本音执行
	waitPlayCount     int    //转接前播放等待音循环次数
	waitPlayDelay     int    //播放完成后，停顿播放时长,单位：秒
	waitNextPlay      string //放音下一步
	bHavePlayLeave    bool
	bLeaveMsg         bool
	isPlayIng         bool
	ivrChan           chan string
	CallTime          int /* 通话时长 */
	HangupSipCode     string
	HangupDescribtion string
	cmdCurr           string
	cmdData           interface{}
	msgChan           chan interface{}
	ssChan            chan interface{}
	ivrHandlePtr      *ivr.Handle
	HangUpReason      interface{}
}

type bridgeCall struct {
	caller string
	callee string
	legDir string
}
